package com.wanxi.feign;

import com.wanxi.model.ClassifyQuery;
import com.wanxi.model.ProductInstanceQuery;
import com.wanxi.model.entity.Classify;
import com.wanxi.model.entity.Product;
import com.wanxi.model.entity.ProductInstance;
import com.wanxi.result.CommonResult;
import com.wanxi.model.ProductQuery;
import com.wanxi.dto.ClassifyDTO;
import com.wanxi.dto.ProductDTO;
import com.wanxi.dto.ProductDetailDTO;
import com.wanxi.dto.ProductInstanceDTO;
import io.swagger.annotations.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

@FeignClient(value = "product-server", path = "/product")
public interface ProductFeignClient {

//    产品
    @ApiOperation(value = "后台新增服务包", response = CommonResult.class)
    @PostMapping("/addProduct")
    public CommonResult addProduct(@RequestBody ProductDTO product);

    @ApiOperation(value = "为服务包分配医生", response = CommonResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "doctorIds", value = "医生id集合", required = true),
            @ApiImplicitParam(name = "productId", value = "服务包id", required = true)
    })
    @PostMapping("/insertDoctorToProduct")
    public CommonResult insertDoctorToProduct(@RequestParam("doctorIds")ArrayList<Long> doctorIds,@RequestParam("productId") Long productId);

    @ApiOperation(value = "修改服务包", response = CommonResult.class)
    @ApiImplicitParams(
            @ApiImplicitParam(name = "id", value = "服务包id", required = true)
    )
    @PutMapping("/updateProduct")
    public CommonResult updateProduct(@RequestParam("id") long id,@RequestBody ProductDTO product);

    @ApiOperation(value = "服务包停启用", response = CommonResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "服务包id", required = true),
            @ApiImplicitParam(name = "state", value = "服务包状态", required = true)
    })
    @PutMapping("/updateProductState")
    public CommonResult updateProductState(@RequestParam("id") Long id,@RequestParam("state") Integer state);

    @ApiOperation(value = "查询服务包详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "productId", value = "服务包id", required = true),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "OK", response = ProductDetailDTO.class, responseContainer = "List")
    })
    @GetMapping("/findProductDetail")
    public CommonResult findProductDetail(@RequestParam("productId") Long productId);

    @ApiOperation(value = "后台查询服务包")
    @ApiResponses({
            @ApiResponse(code = 200, message = "OK", response = ProductDTO.class, responseContainer = "List")
    })
    @GetMapping("/findProduct")
    public CommonResult findProduct(@SpringQueryMap ProductQuery productQuery);

    @ApiOperation(value = "后台查询服务包")
    @ApiResponses({
            @ApiResponse(code = 200, message = "OK", response = Product.class, responseContainer = "List")
    })
    @GetMapping("/findProductBack")
    public CommonResult findProductBack(@SpringQueryMap ProductQuery productQuery);


    //    服务包实体
    @ApiOperation(value = "后台新增服务包实体",response = CommonResult.class)
    @PostMapping("/addProductInstance")
    public CommonResult addProductInstance(@RequestBody ProductInstanceDTO productEntity);



    @ApiOperation(value = "前台查询服务包实体")
    @ApiResponses({
            @ApiResponse(code = 200,message = "OK",response = ProductInstanceDTO.class,responseContainer = "List")
    })
    @GetMapping("/findProductInstance")
    public CommonResult findProductInstance(@SpringQueryMap ProductInstanceQuery productInstanceQuery);


    @ApiOperation(value = "后台查询服务包实体")
    @ApiResponses({
            @ApiResponse(code = 200,message = "OK",response = ProductInstance.class,responseContainer = "List")
    })
    @GetMapping("/findProductInstanceBack")
    public CommonResult findProductInstanceBack(@SpringQueryMap ProductInstanceQuery productInstanceQuery);

    //分类
    @ApiOperation(value = "查询分类")
    @ApiResponses({
            @ApiResponse(code = 200,message = "OK",response = ClassifyDTO.class,responseContainer = "List")
    })
    @GetMapping("/findClassify")
    CommonResult findClassify(@SpringQueryMap ClassifyQuery classifyQuery);

    @ApiOperation(value = "新建分类",response = CommonResult.class)
    @PostMapping("/addClassify")
    CommonResult addClassify(@RequestBody ClassifyDTO classify);

    @ApiOperation(value = "修改分类",response = CommonResult.class)
    @PutMapping("/updateClassify")
    CommonResult updateClassify(@RequestParam("id") Long id, @RequestBody ClassifyDTO classify);

    @ApiOperation(value = "分类停启用",response = CommonResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "分类id",required = true),
            @ApiImplicitParam(name = "state",value = "状态",required = true)
    })
    @PutMapping("/updateClassifyState")
    CommonResult updateClassifyState(@RequestParam("id") Long id, @RequestParam("state") Integer state);


    @ApiOperation(value = "后台查询分类")
    @ApiResponses({
            @ApiResponse(code = 200,message = "OK",response = Classify.class,responseContainer = "List")
    })
    @GetMapping("/findClassifyBack")
    CommonResult findClassifyBack(@SpringQueryMap ClassifyQuery classifyQuery);
}
